var tp_arr = new Array(
    "/static/app/transverse/system/auth01/report/index.htm"
);
var pageNo = window.getUrlParam("p");
var totle = window.getUrlParam("t");
var bt = window.getUrlParam("bt");
console.log(window.location);
window.current = new Vue({
    el: '#current',
    template: window.getTemplate(tp_arr),
    data: {
        pages: [],
        totle: totle ? totle : 0,
        page: pageNo ? pageNo : 1,
        size: 10,
        brandType: bt ? bt : 0,
        sumList: []
    },
    // 属性监听器
    watch: {},
    filters: {
        _formatMoney: function (val) {
            var money = parseFloat(val);
            return window.formatMoney(money, 0);
        },
        _getRowsColor: function (index) {
            var className = 'even';
            if(index % 2 == 0){
                className = '';
            }
            return className;
        }
    },
    computed: {},
    methods: {
        onSearch: function () {
            var brandType = this['brandType'];
            var hrefStr =  window.location.pathname + '?bt=' + brandType;
            window.location.href = hrefStr;
        },
        onSetPage: function (val) {
            var page = this['page'];
            var totle = this['totle'];
            var keyword = this['keyword'];
            var ps = this['personState'];
            if(page != val){
                var hrefStr =  window.location.pathname + '?ps=' + ps;
                if((keywordStr == null && keyword == '')|| keywordStr == keyword){
                    hrefStr += '&p=' + val + '&t=' + totle;
                }
                if(keyword != ''){
                    hrefStr += '&k=' + keyword;
                }
                window.location.href = hrefStr;
            }
        },
        onEditPartner: function (index) {
            var partnerInfo = this['partnerList'][index];
            this['partnerInfo'] = partnerInfo;
            window.poup('#partner_poup');
        },
        onSavePartner: function () {
            window.save_partner();
        },
        onEditIntention: function (index, type) {
            var partnerInfo = this['partnerList'][index];
            this['partnerInfo'] = partnerInfo;
            this['partnerType'] = type;
            window.poup('#intention_poup');
        },
        onSaveIntention: function () {
            window.save_partner_intention();
        }
    }
});

window.get_order_sum = function () {
    var data_arr = {};
    window.ajax({
        url: "/service/Partypromotion/getDinghuohuiOrderSum",
        data: data_arr,
        async: false,
        success: function (d) {
            if (d['status'] == 1) {
                var data = d['data'];
                if (data) {
                    window.current['sumList'] = data;
                }else{
                    window.current['sumList'] = [];
                }
            } else {
                window.custom_toast(d['msg']);
            }
        }
    });
}

window.get_order_sum();
